package com.team233.zuccecho.Bean;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Component;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * 学生信息
 */

@Entity
@Getter
@Setter
public class Student implements Serializable {
    @Id
    @Column(name="student_id")
    private Long stu_id;
    @Column(name="student_name",nullable = false)
    private String stu_name;
    @Column(name="student_password",nullable = false)
    private String stu_pwd;
    @Column(name="student_register_time")
    private Timestamp regTime;
    @Column(name="student_modify_time")
    private Timestamp modTime;

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name="stu_clazz",joinColumns = {@JoinColumn(name="student_id")},
            inverseJoinColumns = {@JoinColumn(name="clazz_id")})
    private List<Clazz> clazzList=new ArrayList<>();

    @OneToMany(mappedBy = "student",cascade = CascadeType.PERSIST)
    private List<Feedback> feedbackList=new ArrayList<>();
    public Student(){

    }

    @Override
    public String toString() {
        return "Student{" +
                "stu_id=" + stu_id +
                ", stu_name='" + stu_name + '\'' +
                ", stu_pwd='" + stu_pwd + '\'' +
                '}';
    }
}
